package com.rg1906.web;

import java.io.IOException;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;
import com.rg1906.service.impl.PermissionListServiceImpl;


@WebServlet("/PermissionList")
public class PermissionList extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
	PermissionListServiceImpl service= new PermissionListServiceImpl();
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
			try {
				HashMap<String,Object> map = new HashMap<>();
				List<com.rg1906.entity.PermissionList> list = service.getPermissionList();
				Long total = service.getCount();
				map.put("rows", list);
				map.put("total", total);
				JSON.toJSONString(map);
				response.getWriter().print(JSON.toJSONString(map));
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		doGet(request, response);
	}

}
